package com.baizhi.springboot.controller;

import com.baizhi.springboot.entity.Resource;
import com.baizhi.springboot.service.Resourceservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
public class ResourceController {

    @Autowired
    private Resourceservice resourceservice;

    @RequestMapping("/selectAllResource")
    @ResponseBody
    public List<Resource> selectAllResource() {
        return resourceservice.selectAllResource();
    }

    @RequestMapping("/error403Page")
    @ResponseBody
    public Map error() {
        HashMap<Object, Object> map = new HashMap<>();
        map.put("message", "没有权限");
        System.out.println("===============");
        return map;
    }
}
